Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POTEL 40 - Init Priority settings #3674

Merged
merged 9 commits into from
Sep 16, 2024
Merged

Conversation

adinauer
Copy link
Member

@adinauer adinauer commented Sep 2, 2024

📜 Description

Sometimes Sentry.init is called multiple times, these settings allow us to control which call to init takes priority.

💡 Motivation and Context

Support different re-init scenarios as well as init calls coming from multiple integrations (e.g. OTel Agent, Logging Integration, Spring Boot)

💚 How did you test it?

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

Copy link
Contributor

github-actions bot commented Sep 2, 2024

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against d63db29

Copy link
Contributor

github-actions bot commented Sep 2, 2024

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 448.59 ms 493.70 ms 45.11 ms
Size 1.70 MiB 2.29 MiB 600.40 KiB

Previous results on branch: feat/potel-40-init-priorty-settings

Startup times

Revision Plain With Sentry Diff
ee4e8d3 472.28 ms 530.15 ms 57.87 ms
e72843a 391.06 ms 452.41 ms 61.34 ms

App size

Revision Plain With Sentry Diff
ee4e8d3 1.70 MiB 2.29 MiB 600.40 KiB
e72843a 1.70 MiB 2.29 MiB 600.40 KiB

@@ -489,6 +489,9 @@ public class SentryOptions {

private @NotNull ScopeType defaultScopeType = ScopeType.ISOLATION;

private @NotNull InitPriority initPriority = InitPriority.MEDIUM;
private boolean forceInit = false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be consistent with the other fields in SentryOptions maybe add a new line in between.
Also these might warrant a JavaDoc description with a short explainer what they're used for

@@ -2562,6 +2592,7 @@ public SentryOptions() {
*/
private SentryOptions(final boolean empty) {
if (!empty) {
setInitPriority(InitPriority.LOWEST);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we keep the default when creating new SentryOptions?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was intended differently, let's remove this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a test here for the default value of InitPriority:

    @Test
    fun `when options is initialized, InitPriority is set to MEDIUM by default`() {
        assertEquals(SentryOptions().initPriority, InitPriority.MEDIUM)
    }


class InitUtilTest {

var previousOptions: SentryOptions? = null
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These could be private.

Also, should we re-init them for each test with @Before?

Copy link
Collaborator

@lbloder lbloder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@adinauer adinauer merged commit c58587b into 8.x.x Sep 16, 2024
21 of 22 checks passed
@adinauer adinauer deleted the feat/potel-40-init-priorty-settings branch September 16, 2024 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants